package com.mc.code.sysService.Impl;

import com.mc.code.entity.sys.SysItems;
import com.mc.code.mapper.SysItemsMapper;
import com.mc.code.sysService.SysItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SysItemsServiceImpl implements SysItemsService {

    @Autowired
    private SysItemsMapper sysItemsMapper;

    @Override
    public SysItems findByItemNo(int itemNo) {
        return sysItemsMapper.findByItemNo(itemNo);
    }

    @Override
    public List<SysItems> queryItems(String itemType, String itemCondition, String itemDid, int currentPage, int pageCount) {
        return sysItemsMapper.queryItems(itemType, itemCondition, itemDid,(currentPage - 1) * pageCount,pageCount);
    }

    @Override
    public int getTotalPage(int pageCount,String itemType, String itemCondition, String itemDid) {
        Integer total =sysItemsMapper.getTotalPage(itemType,itemCondition,itemDid);
        return (total - 1) / pageCount + 1;
    }

    @Override
    public int passItems(int itemNo) {
        return sysItemsMapper.passItems(itemNo);
    }

    @Override
    public int noPassItems(int itemNo) {
        return sysItemsMapper.noPassItems(itemNo);
    }
}
